package org.aspectsense.middleware.adaptation;

import java.awt.Point;
import java.util.HashSet;
import java.util.StringTokenizer;



public class BigraphServiceNode {

	private HashSet<BigraphComponentNode> connections;
	private String serviceName;
	private boolean isEndUser;
	private Point coordinates;
	public BigraphServiceNode(String service) {
		connections = new HashSet<BigraphComponentNode> ();
		serviceName = service;
		this.coordinates = new Point ();
	}
	public void addConnection (BigraphComponentNode cn)
	{
		connections.add(cn);
	}
	
	public HashSet<BigraphComponentNode> getConnections ()
	{
		return this.connections;
	}
	
	public boolean isProvidedBy (BigraphComponentNode cn)
	{
		return connections.contains(cn);
	}
	public String getServiceName ()
	{
		return this.serviceName;
	}
	public String getShortServiceName ()
	{
		String name="";
		StringTokenizer tok = new StringTokenizer (this.serviceName,".");
		while (tok.hasMoreTokens())
		{
			name = tok.nextToken();
		}
		return name;
	}
	public void setEndUser(boolean endUserService) {
		this.isEndUser = endUserService;
		
	}
	
	public boolean isEndUser ()
	{
		return this.isEndUser;
	}
	public void setCoordinates(Point point) {
		this.coordinates = point;
		
	}
	public Point getCoordinates() {
		// TODO Auto-generated method stub
		return this.coordinates;
	}
	

}
